package com.baizhi.service.impl;

import com.baizhi.dao.UserDAO;
import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDAO userDAO;

    /*根据姓名密码查询*/
    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public User queryByNameAndPassword(String username, String password) {
        return userDAO.selectByNameAndPassword(username,password);
    }

    /*增*/
    @Override
    public void add(User user) {
        userDAO.insert(user);
    }
}
